package com.gump.essay.leetcode;

/**
 * @auther zzc
 * @date 2021/3/31 17:33
 */
public class 翻转一颗二叉树 {

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right; 
        }
    }

    public TreeNode revTreeNode(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode left = revTreeNode(root.left);
        TreeNode right = revTreeNode(root.right);
        root.left = right;
        root.right = left;
        return root;
    }


}
